package top.dfghhj.chapter04;

/**
 * @Author: feifeng
 * @Description: old gc
 * @Date: 2021/4/8 12:16
 */
public class JvmTest {

    /**
     * JVM 参数:
     * -XX:NewSize=10485760 -XX:MaxNewSize=10485760 -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:SurvivorRatio=8  -XX:MaxTenuringThreshold=15 -XX:PretenureSizeThreshold=3145728 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gc.log
     * @param args
     *
     * Java HotSpot(TM) 64-Bit Server VM (25.281-b09) for windows-amd64 JRE (1.8.0_281-b09), built on Dec  9 2020 13:54:07 by "" with MS VC++ 15.9 (VS2017)
     * Memory: 4k page, physical 16571704k(8186832k free), swap 19062072k(9340720k free)
     * CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=15 -XX:NewSize=10485760 -XX:OldPLABSize=16 -XX:PretenureSizeThreshold=3145728 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:-UseLargePagesIndividualAllocation -XX:+UseParNewGC
     * 0.066: [GC (Allocation Failure) 0.066: [ParNew (promotion failed): 7420K->8229K(9216K), 0.0019946 secs]0.075: [CMS: 8194K->6903K(10240K), 0.0018142 secs] 11516K->6903K(19456K), [Metaspace: 2657K->2657K(1056768K)], 0.0109681 secs] [Times: user=0.00 sys=0.00, real=0.02 secs]
     * Heap
     *  par new generation   total 9216K, used 2130K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
     *   eden space 8192K,  26% used [0x00000000fec00000, 0x00000000fee14930, 0x00000000ff400000)
     *   from space 1024K,   0% used [0x00000000ff500000, 0x00000000ff500000, 0x00000000ff600000)
     *   to   space 1024K,   0% used [0x00000000ff400000, 0x00000000ff400000, 0x00000000ff500000)
     *  concurrent mark-sweep generation total 10240K, used 6903K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
     *  Metaspace       used 2663K, capacity 4486K, committed 4864K, reserved 1056768K
     *   class space    used 283K, capacity 386K, committed 512K, reserved 1048576K
     *
     */
    public static void main(String[] args) {

        byte[] array1 = new byte[4 * 1024 * 1024];
        array1 = null;

        byte[] array2 = new byte[2 * 1024 * 1024];
        byte[] array3 = new byte[2 * 1024 * 1024];
        byte[] array4 = new byte[2 * 1024 * 1024];
        byte[] array5 = new byte[128 * 1024];

        byte[] array6 = new byte[2 * 1024 * 1024];
    }
}
